import request from '@/utils/request'

// 获取广告列表
export function getAdsList(params: any) {
    return request.get({ url: '/ads.tencent_advertising_user_ad_list/lists', params })
}

// 创建广告
export function createAd(data: any) {
    return request.post({ url: '/ads.tencent_advertising_user_ad_list/add', data })
}

// 更新广告
export function updateAd(id: string, data: any) {
    return request.post({ url: '/ads.tencent_advertising_user_ad_list/edit', data: { id, ...data } })
}

// 删除广告
export function deleteAd(params: { account_id: string; ad_group_id: string }) {
    return request.post({ url: '/ads.tencent_advertising_user_ad_list/delete', data: params })
}

// 获取广告详情
export function getAdDetail(id: string) {
    return request.get({ url: '/ads.tencent_advertising_user_ad_list/detail', params: { id } })
}
// 
// 获取广告详情
export function get_targeting_tags(params: any, options?: any) {
    return request.get({ url: '/ads.tencent_advertising_user_ad_list/get_targeting_tags', params }, options)
}

// 获取第三方资产列表
export function get_target_assets(params: any, options?: any) {
  return request.get({ url: '/ads.tencent_advertising_user_ad_list/get_target_assets', params }, options)
}
// 获取营销目的类型
export function get_target_targets(params: any, options?: any) {
    return request.get({ url: '/ads.tencent_advertising_user_ad_list/get_marketing_target_types', params }, options)
  }

// 获取优化目标权限
export function get_optimization_goal_permissions(params: {
  ad_account_id: string;
  account_id: string;
  marketing_goal: string;
  marketing_target_type: string;
}, options?: any) {
  return request.get({ url: '/ads.tencent_advertising_user_ad_list/get_optimization_goal_permissions', params }, options)
}

// 复制广告
export function copyAd(params: { ids: string[]; ad_group_name: string; corporation_name: string; ad_group_id: string; ad_account_id: string; account_id: string; begin_date?: string; end_date?: string }) {
    return request.post({ url: '/ads.tencent_advertising_user_ad_list/ad_copy', data: params })
}

// 获取广告主列表
export function getCorporationList(params: { page: number; limit: number; ad_account_id?: string }) {
    return request.get({ url: '/ads.tencent_advertising_user_ad/lists', params })
}

// 获取自定义人群列表
export function get_custom_audience(params: {
  account_id: string;
  keyword?: string;
  page?: number;
  limit?: number;
}, options?: any) {
  return request.get({ url: '/ads.tencent_advertising_user_ad_list/get_custom_audience', params }, options)
}

// 获取数据分析报告
export function getAdReport(params: { id: string }) {
  return request.get({ url: '/ads.tencent_advertising_user_ad_list/report', params })
}
